package com.itheima.Text;

import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class Text02 {
    //实现带概率的随机点名
    public static void main(String[] args) {
        ArrayList<Integer> list=new ArrayList<>();

        Collections.addAll(list,1,1,1,1,1,1,1);
        Collections.addAll(list,0,0,0);

        //在该集合中随机抽取
        Random r=new Random();
        int i = r.nextInt(list.size());
        int  number = list.get(i);
        System.out.println(number);

        //根据随机得到的number决定要在男生集合里还是在女生集合里实现

        ArrayList<String> boylist = new ArrayList<>();
        Collections.addAll(boylist,"范闲","范建","范统","杜子腾","宋合泛","侯笼藤","朱益群","朱穆朗玛峰");
        ArrayList<String> girllist=new ArrayList<>();
        Collections.addAll(girllist,"杜琦燕","袁明媛","李猜","田蜜蜜");

        if(number==1)
        {
            int boyindex=r.nextInt(boylist.size());
            System.out.println(boylist.get(boyindex));
        }else
        {
            int i1 = r.nextInt(girllist.size());
            System.out.println(girllist.get(i1));
        }


    }
}
